library(plotly)
## Loading required package: ggplot2
##
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
##
## last_plot
## The following object is masked from 'package:stats':
##
## filter
## The following object is masked from 'package:graphics':
##
## layout
library(tidyverse)
## ── Attaching packages
## ───────────────────────────────────────
## tidyverse 1.3.2 ──
## ✔ tibble 3.1.8 ✔ dplyr 1.0.10
## ✔ tidyr 1.2.1 ✔ stringr 1.4.1
## ✔ readr 2.1.3 ✔ forcats 0.5.2
## ✔ purrr 0.3.5
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks plotly::filter(), stats::filter()
## ✖ dplyr::lag() masks stats::lag()
fig <- plot_ly() %>%
add_lines(x = c("a","b","c"), y = c(1,3,2))%>%
layout(title="sample figure", xaxis = list(title = 'x'), yaxis = list(title = 'y'), plot_bgcolor = "#c7daec")
str(fig$x)
## List of 7
## $ visdat :List of 1
## ..$ a9b71afda9f5:function ()
## $ cur_data : chr "a9b71afda9f5"
## $ attrs :List of 2
## ..$ a9b71afda9f5:List of 3
## .. ..$ alpha_stroke: num 1
## .. ..$ sizes : num [1:2] 10 100
## .. ..$ spans : num [1:2] 1 20
## ..$ a9b71afda9f5:List of 8
## .. ..$ alpha_stroke: num 1
## .. ..$ sizes : num [1:2] 10 100
## .. ..$ spans : num [1:2] 1 20
## .. ..$ x : chr [1:3] "a" "b" "c"
## .. ..$ y : num [1:3] 1 3 2
## .. ..$ type : chr "scatter"
## .. ..$ mode : chr "lines"
## .. ..$ inherit : logi TRUE
## .. ..- attr(*, "class")= chr [1:2] "plotly_line" "list"
## $ layout :List of 3
## ..$ width : NULL
## ..$ height: NULL
## ..$ margin:List of 4
## .. ..$ b: num 40
## .. ..$ l: num 60
## .. ..$ t: num 25
## .. ..$ r: num 10
## $ source : chr "A"
## $ config :List of 2
## ..$ modeBarButtonsToAdd: chr [1:2] "hoverclosest" "hovercompare"
## ..$ showSendToCloud : logi FALSE
## $ layoutAttrs:List of 1
## ..$ a9b71afda9f5:List of 4
## .. ..$ title : chr "sample figure"
## .. ..$ xaxis :List of 1
## .. .. ..$ title: chr "x"
## .. ..$ yaxis :List of 1
## .. .. ..$ title: chr "y"
## .. ..$ plot_bgcolor: chr "#c7daec"
## - attr(*, "TOJSON_FUNC")=function (x, ...)
fig